//
//  YCRegisterTextField.m
//  YCSchool
//
//  Created by gmall on 16/5/7.
//  Copyright © 2016年 yanglinxia. All rights reserved.
//

#import "YCRegisterTextField.h"

@implementation YCRegisterTextField

- (instancetype)initWithLeftViewTitle:(NSString *)title
{
    self = [super init];
    if (self) {
        self.layer.borderWidth = 1;
        self.layer.borderColor = [UIColor yc_colorWithUInt:0xe0e0e0].CGColor;
        self.font = [UIFont systemFontOfSize:15];
        self.backgroundColor = [UIColor whiteColor];
        self.clearButtonMode = UITextFieldViewModeWhileEditing;
        
        //leftView
        UILabel *tipLabel = [[UILabel alloc] init];
        tipLabel.font = [UIFont boldSystemFontOfSize:15];
        CGSize size = [@"我的名字" yc_sizeWithFont:self.font MaxSize:CGSizeMake(CGFLOAT_MAX, 0)];
        tipLabel.frame = CGRectMake(0, 0, size.width + 34, 40);//左右条留14间距
        tipLabel.textColor = [UIColor yc_colorWithUInt:0x3d3e40];
        tipLabel.text = title;
        tipLabel.textAlignment = NSTextAlignmentCenter;
        self.leftView = tipLabel;
        self.leftViewMode = UITextFieldViewModeAlways;
    }
    return self;
}

@end
